package com.talent.service.base.auth.fegin;

import com.talent.service.base.auth.bo.JwtTokenBo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * @Author: hszhou
 * @Date: 2025/2/17 9:06
 * @Description: 认证服务器的接口
 */
@FeignClient(name = "auth-service",contextId = "auth")
public interface Oauth2Feign {


    /**
     * 登陆
     * @param grantType 登录类型
     * @param username 用户名
     * @param password 密码
     * @param loginType 登陆类型
     * @param basicToken 客户端加密
     * @return 登陆返回对象
     */
    @PostMapping("oauth/token")
    ResponseEntity<JwtTokenBo> login(@RequestParam(value = "grant_type",defaultValue = "password") String grantType,
                                     @RequestParam("username") String username,
                                     @RequestParam("password") String password,
                                     @RequestParam("login_type") String loginType,
                                     @RequestHeader(value = "Authorization",defaultValue = "Basic dGFsZW50OjEyMzQ1Ng==")String basicToken); //Basic dGFsZW50OjEyMzQ1Ng== 由第三方客户端加密来的
}
